There are thousands of ways to do sorting. Anyhow in java, it is most common to use the three sorts that are explained below.

1) Selection- A sorting method is trying to SET an arrays in order smalleset to biggest and swaps it with current slot.
Benefits: Easy to code
Downfall: Not very fast
1. Setting in order smallest to biggest.
2. Swap with current slot.
This way uses lots of comparisons. Say you have a suit of cards. Each time you look for the smallest card, you have to compare that card to every other card that you have. And each time you find the smallest, you switch it with the card in the spot that the smallest card should be.
1) Get the array A
2) Start from beginning to the second to last slot
a) Start from beginning and find the smallest value
b) Keep finding the next smallest vlue and put it after the smallest one.


2) Insertion- A sorting method that looks at the current slot and bubbles it down until it is in the right location.
Benefits: Easy to code
Downfall: Not very fast
1. Look at the current slot.
2. Bubbles the value down the array until it is in the right location.
This way uses less comparisons, but potentially many more swaps. Again, think of a suit of cards. Each time a card doesn't fit, you have to swap it down the line (or "bubble", whichever word you prefer). If you have all the cards in order and then the last one is the Ace, then you have to bubble it down 12 slots just for it to be in the right spot.

3) Merge- Divides everything in half, and proceeds down the line.
Benefits: Very fast
Downfall: Hard to code, have to make a new array(s), takes up speed and memory.
1. Divide the array until each values become individual elements.
2. Pair the individual values. For each step, put them in order until the whole array gets all together.
A merge sort is very fast compared to the other two. It does few comparisons and a very low number of swaps. However, this type is not efficient in memory size. Each time you recombine, a new Array is created. This takes up a lot of space on the memory to store all of the different Arrays.
-Example:
-->This is the array we will be editing
| 1 | 3 | 9 | 6 | 2 | 5 | 7 |
--Divide it in half, by adding the first and last slots, then dividing by 2.
--This gives you the middle slot.
Ex. (0+6)/2 = 3 <- You divide it at slot 3, as seen below
-----1 3 9 6 | 2 5 7
--Do it again
-----1 3 | 9 6 | 2 5 | 7
Now then, is the sort each little set
-----is 1 bigger than 3? no, so leave it
-----is 9 bigger than 6? yes, so switch it to 6 9
-----is 2 bigger than 5? no, so leave it
-----is 7 in order? yes.
Revert to it being in half, 1 3 6 9 | 2 5 7
----Organize it, comparing the first to the first.
Basically like this:
1 & 2 -> 1 Remove the one and insert into its position
2 & 3 -> 2 Remove the two and insert into its position
3 & 5 -> 3 Remove the three and insert into its position
Continue, until all the numbers are in order.
---Finished---